import time
def bubble_sort(nums):
    m1 = read2list(nums+'.txt')
    swapped = True
    t_start = time.time()
    while swapped:
        swapped = False
        for i in range(len(m1) - 1):
            if m1[i] > m1[i + 1]:

                m1[i], m1[i + 1] = m1[i + 1], m1[i]

                swapped = True
    t_finish = time.time()
    print(nums,round((t_finish-t_start)*1000), "milliseconds")

def read2list(filename):
    file = open(filename, 'r')
    data = file.readlines()
    return data
bubble_sort("m1_sorted")
bubble_sort("m2_reverse")
bubble_sort("m3_shuffle")

